package cn.edu.zafu.bigdata.Yum;
import java.util.Scanner;
public class InvalidScoreException extends Exception{
    public InvalidScoreException(String s){
        super(s);
    }
    public static void checkScore(int score) throws InvalidScoreException{
        if(score>100||score<0){
            throw new InvalidScoreException("分数必须在0到100之间！");
        }
        System.out.println("分数有效："+score);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        try {
            System.out.println("输入分数:");
            int score=scanner.nextInt();
            checkScore(score);
        }catch (InvalidScoreException err){
            System.out.println("报错："+err.getMessage());
        }
    }
}
